Skip to content

fix: TimescaleDB's pod reaps orphaned exec processes, so one killed by a signal no longer crash-restarts the database - #800

Merged
lukepolo merged 1 commit into
mainfrom
fix/timescaledb-pid1-reaper
Nov 24, 2026
Merged

lukepolo merged 1 commit into
mainfrom
fix/timescaledb-pid1-reaper

Conversation

@lukepolo

Copy link
Copy Markdown
Contributor

TimescaleDB's postmaster was PID 1 in its pod. Anything a kubectl exec leaves behind when it's cut off (agent backups, restores, a dropped shell) becomes its child. When such an orphan later dies by a signal, Postgres logs "untracked child process … was terminated by signal 9" and crash-restarts the whole database.

  • shareProcessNamespace: true on the TimescaleDB pod: the pause container is PID 1 and reaps orphans. Nothing in the pod relies on postgres being PID 1: the probes are TCP, there is no preStop and no kill 1, the major upgrade runs in its own Job pod, and the runtime still sends SIGTERM to postgres on shutdown.
  • The pod has one container, so the only thing newly visible is the pause process. A sidecar added later would see postgres's processes.
  • tests/timescaledb/orphan_reaper_test.sh (TimescaleDB Docker job) uses the pinned image. With postgres as PID 1, a killed orphan restarts the database; with --init as PID 1, it doesn't.
  • tests/scripts/timescaledb_pod_test.sh checks the setting is rendered in all four overlays update.sh applies.

The rollout restarts the database once. If it ships in the same release as #796's reserved-slots change, both land in that one restart.

…y a signal no longer crash-restarts the database
@lukepolo
lukepolo merged commit 94e26b6 into main Nov 24, 2026
4 checks passed
@lukepolo
lukepolo deleted the fix/timescaledb-pid1-reaper branch November 24, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant